<cfcomponent output="false" displayname="userService" hint="I am a user service.">

	<cffunction name="setUserDAO" access="public" returntype="void" output="false">
		<cfargument name="userDAO" type="cfhibernate.model.user.userDAO" required="yes">
		<cfset variables.userDAO = arguments.userDAO>
	</cffunction>

	<cffunction name="setUserGateway" access="public" returntype="void" output="false">
		<cfargument name="userGateway" type="cfhibernate.model.user.userGateway" required="yes">
		<cfset variables.userGateway = arguments.userGateway>
	</cffunction>

	<cffunction name="getUser" access="public" returntype="cfhibernate.model.user.user" output="false">
		<cfargument name="user_id" type="numeric" required="yes">
		<cfset var user = "">
		<cfif arguments.user_id neq 0>
			<cfset user = variables.userDAO.read(arguments.user_id)>
		<cfelse>
			<cfset user = createObject("component", "cfhibernate.model.user.user").init()>
		</cfif>
		<cfreturn user>
	</cffunction>

	<cffunction name="saveUser" access="public" returntype="void" output="false">
		<cfargument name="user" type="cfhibernate.model.user.user" required="yes">
		<cfset variables.userDAO.save(arguments.user)>
	</cffunction>

	<cffunction name="getUsers" access="public" returntype="query" output="false">
		<cfargument name="args" required="no" type="struct" default="struct">
		<cfreturn variables.userGateway.getusers(argumentcollection=arguments.args)>
	</cffunction>

</cfcomponent>